import React, { Component } from 'react';
import { NavBar, Space, Toast } from 'antd-mobile'
import '../styles/Ding.scss'
import service from '../api';
class Ding extends Component {
    constructor(props) {
        super(props)
        this.state = {
            userid: '',
            list: [],
        }
    }
    back() {
        this.props.history.go(-1)
    }
    async componentDidMount() {
        var res = await service.shopcar.cart_list({ userid: localStorage.getItem('userid') })
           this.setState({list:res.data.data})
    }
    render() {
        return (
            <div className='ding'>
                <div className="top">
                    <NavBar back='返回' onBack={() => { this.back() }}>
                        全部订单
                    </NavBar>
                </div>
                <div className="car">
                    {
                        this.state.list?.map((item, index) => {
                            return (

                                <div className="box" key={index}>
                                    <div className="imgs">
                                        <img src={item.img1} alt="" />
                                    </div>
                                    <div className="text">
                                        <div className="proname">{item.proname}</div>
                                        <div className="price">
                                            <span className='jiage'>{item.originprice}</span>
                                            <span className='jiage'>x{item.num}</span>
                                        </div>
                                    </div>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default Ding;